package iscript.gameFramework.IsoLibarys.data 
{
	import flash.utils.setTimeout;
	import iscript.gameFramework.IsoLibarys.display.IsoSprite;
	import iscript.gameFramework.IsoLibarys.IsoView;
	/**
	 * ...
	 * @author raymond
	 */
	public class IsoSpriteBuffer 
	{
		
		public function IsoSpriteBuffer() 
		{
			
		}
		
		private var  _data:Vector.<IsoSpriteBufferNode> = new Vector.<IsoSpriteBufferNode>();
		
		static private var _instance:IsoSpriteBuffer;
		
		static public function  getInstance():IsoSpriteBuffer {
			if (_instance == null) _instance = new IsoSpriteBuffer();
			return _instance;
		}
		 
		public function  get  count():int { return _data.length; } 
	    	
	    public function add(isoview:IsoView,isoSprite:IsoSprite):void {
		   addLogic(isoview, isoSprite);
		}
		 
		/*public function addDelay(isoview:IsoView,isoSprite:IsoSprite,delayNumber:Number):void {
		    setTimeout(addLogic, delayNumber, isoview, isoSprite);
		}*/
		 
		private function addLogic(isoview:IsoView, isoSprite:IsoSprite):void {
			 var node:IsoSpriteBufferNode = new IsoSpriteBufferNode();
			 node.isoview = isoview;
			 node.isoSprite = isoSprite;
			 _data.push(node);
		  }
		 
		public function  shift():IsoSpriteBufferNode {
			   return _data.shift();
			}	
		
	}

}
